includeTargets << grailsScript( "Clean" )  
includeTargets << grailsScript( "War" )  

target('default': "The description of the script goes here!") {
    explodedWar()
}

target(explodedWar: "The implementation task") {

	depends( clean,  war)

        def fileName = grailsAppName	

        def version = metadata.getApplicationVersion()
        
        if (version) {
                version = '-'+version
        } else {
                version = ''
        }
        
        def warName = "${basedir}/${fileName}${version}.war"
        def stagingDir = "${basedir}/explodedWar/${grailsAppName}"		
        Ant.delete(dir:stagingDir)
        Ant.mkdir(dir:stagingDir)
	    Ant.unwar(dest:stagingDir, src:warName,overwrite:true);
}                                                                    

